package cc.chinagps.gboss.mq.reader;

import cc.chinagps.gateway.buff.DeliverBuff;
import cc.chinagps.gboss.GpsManager;
import cc.chinagps.gboss.common.Config;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

@Slf4j
@MqReader(name = Config.MQ.GPS_NAME, type = 2)
public class GpsReader extends AbstractReader {
    @Override
    public void handleMQData(byte[] data) {
        try {
            DeliverBuff.MultDeliverGPS multDeliverGPS = DeliverBuff.MultDeliverGPS.parseFrom(data);
            List<DeliverBuff.DeliverGPS> list = multDeliverGPS.getMdeliverGPSList();
            GpsManager.getInstance().addGpsList(list);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }
    }
}
